package com.xiyuan.smartutils.template.engine.statement;

import java.io.PrintWriter;

import com.xiyuan.smartutils.Htmls;

import com.xiyuan.smartutils.template.engine.StatementParser;
import com.xiyuan.smartutils.template.engine.TagType;
import com.xiyuan.smartutils.template.engine.VariableMap;

public class _Echo_Format extends _Echo
{
    private static final long serialVersionUID = 1L;
    
    public _Echo_Format(StatementParser parser)
    {
        super(parser);
    }
    
    protected void build(VariableMap variableMap, PrintWriter out)
    {
        if (expressions.isEmpty())
            return;
        
        Object obj = expressions.get(0).execute(variableMap);
        out.print(Htmls.filterAll(String.valueOf(obj)));
    }
    
    @Override
    public TagType getType()
    {
        return TagType.ECHO_FORMAT;
    }
}
